package com.ht.medicaltreatment.activity.haocai2.viewmodel

import com.hjq.http.EasyHttp
import com.hjq.http.listener.OnHttpListener
import com.ht.medicaltreatment.bean.ConsumableListDetailBean
import com.ht.medicaltreatment.bean.ListData
import com.ht.medicaltreatment.http.api.ConsumableDetailAPI
import com.ht.medicaltreatment.viewmodel.BaseViewModel

class ConsumableDetailViewModel:BaseViewModel() {
    fun detail(id:String,sign:String,onSuccess:(MutableList<ListData>)->Unit){
        EasyHttp.post(this)
            .api(ConsumableDetailAPI(sign,id))
            .request(object : OnHttpListener<ConsumableListDetailBean>{
                override fun onHttpSuccess(result: ConsumableListDetailBean) {
                    onSuccess(result.data)
                }

                override fun onHttpFail(e: Exception) {
                    dismissProgress(e.message?:"请求错误")
                }
            })
    }

}